#ifdef UTIL_PLATFORM_LINUX
#include "lang/System.h"
#include "io/OutputStream.h"
#include "io/PrintStream.h"
#include <unistd.h>
using namespace yzrilyzr_io;
using namespace yzrilyzr_array;
namespace yzrilyzr_lang{
	ECLASS(UnixOutputStream, public OutputStream){
	public:
	UnixOutputStream(){
	}
	void write(int32_t b)override{
		char c=b;
		::write(1, &c, 1);
	}
	void write(const ByteArray & array, u_index off, u_index len)override{
		::write(1, array._array+off, len);
	}
	};
	ECLASS(UnixInputStream, public InputStream){
	public:
		UnixInputStream(){
	}
	int32_t read()override{
		char c;
		ssize_t readCount=::read(1, &c, 1);
		if(readCount==0)return -1;
		return c&0xff;
	}
	u_index read(ByteArray & array, u_index off, u_index len)override{
		ssize_t readCount=::read(1, array._array+off, len);
		return readCount;
	}
	};
	yzrilyzr_io::OutputStream & System::createOutStream(){
		static UnixOutputStream* ins=new UnixOutputStream();
		return *ins;
	}
	yzrilyzr_io::InputStream & System::createInputStream() {
		static UnixInputStream* ins=new UnixInputStream();
		return *ins;
	}
}
#endif // UTIL_PLATFORM_LINUX